﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PACKETPARSERMAX20.CORE;

namespace PACKETPARSERMAX20.CORE
{
    public class MangosDatabase : DataAccessBase
    {
        public MangosDatabase()
            : base("mangos", true)
        {
        }

        public List<uint> ValidAuraSpellIDList()
        {
            List<uint> result = new List<uint>();

            string command = "select Distinct(auras) from creature_addon where not auras is null and not auras = '' order by auras";
            using (var datatable = base.ExecuteGetDataTable(command))
            {
                foreach (System.Data.DataRow row in datatable.Rows)
                {
                    string[] split = row[0].ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                    for (int i = 0; i < split.Length; i++)
                    {
                        var spell = uint.Parse(split[i]);
                        var eff = split[i + 1];
                        i++;

                        if (!result.Contains(spell)) result.Add(spell);
                    }



                }
            }

            return result;
        }
    }
}
